package com.lhn.netty.netty_demo.tcp;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @author lhn
 * @date 2025/06/11 19:27
 * @since 1.0.0
 **/
public class MyServerInitializer extends ChannelInitializer <SocketChannel> {

    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();

        // 加入一个自定义的处理器 处理业务逻辑
        pipeline.addLast("MyServerHandler", new MyServerHandler());
    }
}